<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

    <div class="container"></div>
    <script>
        var users = {
            name: "alice",
            age: 30,
            boys: [
                {
                    name: "胡歌",
                    height: 180,
                    weight: 150
                },
                {
                    name: "彭于晏",
                    height: 180,
                    weight: 150
                },
                {
                    name: "吴彦祖",
                    height: 180,
                    weight: 150
                }
            ],
            friends: [
                {
                    name: "唐毅",
                    height: 150,
                    weight: 150
                },
                {
                    name: "王梓伟",
                    height: 178,
                    weight: 150
                },
                {
                    name: "张大爷",
                    height: 170,
                    weight: 150
                }
            ]
        };

        var container=document.querySelector(".container");
        var h2=document.createElement("h2");
        h2.innerHTML=users.name;
        container.appendChild(h2);

        var h2Age=document.createElement("h2");
        h2Age.innerHTML=users.age;
        container.appendChild(h2Age);

        var div=document.createElement("div");
        div.innerHTML="我的男朋友们:";
        container.appendChild(div);
        
        var divWrap=document.createElement("div");
        for(var i=0;i<users.boys.length;i++){
            var p=document.createElement("p");
            p.innerHTML=users.boys[i].name+":"+users.boys[i].height;
            divWrap.appendChild(p);
        }
        container.appendChild(divWrap);

        var div2=document.createElement("div");
        div2.innerHTML="我的朋友们:";
        container.appendChild(div2);


        var divWrap2=document.createElement("div");
        for(var i=0;i<users.friends.length;i++){
            var p=document.createElement("p");
            p.innerHTML=users.friends[i].name+":"+users.friends[i].height;
            divWrap2.appendChild(p);
        }
        container.appendChild(divWrap2);


    </script>
</body>

</html>